// by shawn.tan
#ifndef _C_BFM_DPI_H
#define _C_BFM_DPI_H
#include "stdint.h"
#include "stdio.h"
#include "stdlib.h"

#include "svdpi.h"
#include "vpi_user.h"

#define U8 uint8_t
#define U16 uint16_t
#define U32 uint32_t

void TestStart();
void TestEnd();
void wait_us(U32 uint);
void wait_ms(U32 uint);

void reg_read(U32 _addr, U32 *_data);
void reg_write(U32 _addr, U32 _data);

void REG_WRITE(U32 _addr, U32 _data); 
U32 REG_READ(U32 _addr); 

#define VERI_BEGIN_TEST \
   U32 __attribute__((visibility("default"))) RunTest(U32 *retval) {\
   TestStart();

#define VERI_END_TEST(err_num) \
   *retval = err_num; \
   TestEnd();\
   return 0;\
}

#define PRINT(CONTENT, ...) \
   vpi_printf("DEBUG IN CPU BFM TEST: %s %d"CONTENT,__FUNCTION__,__LINE__,  ## __VA_ARGS__);

#endif
